#pragma once

#ifndef ConstantTable_h
#define ConstantTable_h

#include <vector>
#include <map>
#include "Type.h"

class ConstantTable{

private:
	typedef std::map<Type::Index::Line, Type::List::Constant> ConstantTableType;
	typedef std::map<Type::Constant, Type::Map::EntityLine> LineTableType;

	ConstantTableType constantTable;
	LineTableType lineTable;

public:
	ConstantTable(void);
	~ConstantTable(void);
	void clear();

	// insert constant with the given Line, returns status of operation
	bool insertConstant(Type::Index::Line, Type::Entity::Line, Type::Constant);

	// get all constants
	const Type::List::Constant& getConstants();
	// get constants with the given Line
	const Type::List::Constant& getConstantsByLine(Type::Index::Line);

	// get the list of lines associated with the given constant
	const Type::List::Line& getLinesByConstant(Type::Constant);
	// get the list of lines with the given line entity associated with the given constant
	const Type::List::Line& getLinesByConstant(Type::Constant, Type::Entity::Line);

	// check for exsistence of the given constant
	bool isConstantExistsInLine(Type::Constant);
	// check for exsistence of the given line
	bool isLineExistsInConstant(Type::Index::Line);
};
#endif
